//
//  ZMHomeViewController.swift
//  LoveBeen
//
//  Created by pg on 2017/8/6.
//  Copyright © 2017年 pg. All rights reserved.
//

import UIKit

class ZMHomeViewController: ZMBaseController {

    override func viewDidLoad() {
        super.viewDidLoad()

        self.view.backgroundColor = #colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1)
        //self.title = "shouye"
        //数据库操作
        setupDataBase()
        
        //导航条添加搜索按钮
        addSearchNavItem()
        
        //
    }
    
    //MARK:- 添加搜索按钮  导航条
    private func addSearchNavItem(){
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "icon_search"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(searchItemClick))
        
    }
    //MARK:- 导航条  搜索按钮点击事件
    func searchItemClick(){
        
        let searchVC = ZMSearchViewController()
        searchVC.selectedProductsModelArray = gl_selectedProductArray
        searchVC.hidesBottomBarWhenPushed = true
        
        self.navigationController?.pushViewController(searchVC, animated: true)
    }

    
    
    private func setupDataBase(){
        
        
        
        
    }
    
    
    
    override func setupNavWhenNotLogin() {
        super.setupNavWhenNotLogin()
        
        //#FDCE30  #FDCE30
        //设置导航条背景色
        self.navigationController?.navigationBar.barTintColor = UIColor.zm_colorWithHex(hexColor: 0xfdce30)
        
        //设置左边二维码扫描按钮
        let navleftItem = UIBarButtonItem(image: UIImage(named:"icon_black_scancode")?.withRenderingMode(.alwaysOriginal), style: UIBarButtonItemStyle.plain, target: self, action: #selector(QRcodesFounction))
        self.navigationItem.leftBarButtonItem = navleftItem

    }
   override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(true)
        
       // self.tabBarController?.tabBar.isHidden = false
        
    
    }
    
    //MARK:- 二维码扫描按钮
    func QRcodesFounction(){
       
        
    }
    
    override func changeAddrButtonClick() {
        
        let vc = ZMLoginViewController()
        self.navigationController?.pushViewController(vc, animated: true)
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

 

}
